package codingforgreat.lchot150;

public class Lc387 {
    public int firstUniqChar(String s) {
        int count[]= new int[26];
        char[] str = s.toCharArray();
        int len=s.length();
        for(int i=0;i<len;i++){
            count[str[i]-'a']++;
        }
        for(int i=0;i<len;i++){
            if(count[str[i]-'a']==1){
                return i;
            }
        }
        return -1;
    }
}
